<?php
class Product extends Eloquent{
	protected $fillable = array("title","description","content","img","price","votes","viewed","cateproductID","userID");
	public function cateproducts(){
		return $this->belongsTo("Cateproduct","cateproductID");
	}

	public function users(){
		return $this->belongsTo("User","userID");
	}

	public function orders(){
		return $this->belongsToMany('Order','orders_products')->withTimestamps();
	}

	public static $product_rules = array(
		"title"		=>	"required",

	);

	public static $product_langs = array(
		"title.required"	=>	"Vui lòng nhập tên tiêu đề",
	);
}